import moment from "moment";

// 获取当前日期时间字符串
export function getCurDateTimeStr(type = "date") {
    let dateTime = ""
    switch (type) {
        case "date":
            dateTime = moment().format('YYYY-MM-DD')
            break
        case "dateTime":
            dateTime = moment().format('YYYY-MM-DD HH:mm:ss')
            break
    }
    return dateTime
}

// 日期时间对象转换成日期字符串
export function formatDateTimeToStr(dateTime) {
    let str = moment(dateTime).format('YYYY-MM-DD HH:mm:ss')
    return str
}